import { getCurrentInstance, ComponentInternalInstance, ComponentPublicInstance } from 'vue';

export interface CurrentInstance extends ComponentPublicInstance {
    goPage: (name: string, query: any) => void;
    replace: (name: string, query: any) => void;
    goBack: ()=>void;
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default () => {
    const { appContext } = getCurrentInstance() as ComponentInternalInstance;
    const instance = appContext.config.globalProperties as CurrentInstance;
    return instance;
}